package com.itheima.health.controller;

import com.itheima.health.entity.Result;
import com.itheima.health.service.SetmealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("setmeal")
@Api(tags = "移动端模块管理")
public class H5Controller {
    @Reference
    private SetmealService setmealService;

    @GetMapping("findAllSetmeal")
    @ApiOperation(value = "查询所有套餐" ,notes = "查询套餐信息")
    public Result findAllSetmeal(){
        return  new Result(setmealService.list());
    }


    //根据套餐id查询对应的套餐详情信息setmeal/findSetMealDetail
    @GetMapping("findSetMealDetail/{id}")
    @ApiOperation(value = "查询套餐详情" ,notes = "查询套餐详情信息")
    public Result findSetMealDetail(@PathVariable("id") Integer id){
        return  new Result(setmealService.findSetmealById(id));
    }


    //根据套餐id查询对应的套餐详情信息setmeal/findById/
    @GetMapping("findById/{id}")
    @ApiOperation(value = "查询套餐信息" ,notes = "查询套餐信息")
    public Result findById(@PathVariable("id") int id){
        return  new Result(setmealService.findSetmealById(id));
    }
}
